package edu.ahut.corejava3;

import java.util.Deque;
import java.util.LinkedList;

/**
 * 顺序队列
 */
public class QueueDemo1 {
    public static void main(String[] args) {
        Deque<Integer> q = new LinkedList<Integer>();
        q.addLast(1);//1
        q.addFirst(2);//2 1
        q.addLast(3);//2 1 3

        q.addFirst(4);// 4 2 1 3
        q.pollFirst();// 2 1 3
        q.pollLast();//2 1




//        while (!q.isEmpty()) {
//            System.out.println(q.peek());//队头元素
//            q.poll();//出队操作
//        }
        while(!q.isEmpty()){
            System.out.println(q.getLast());
            q.pollLast();
        }




    }
}
